package com.dtu.snapdroid;

import android.app.Activity;
import android.os.Bundle;
import android.widget.ImageButton;


import com.facebook.android.AsyncFacebookRunner;
import com.facebook.android.Facebook;
import com.facebook.android.LoginButton;
import com.facebook.android.SessionEvents;
import com.facebook.android.SessionStore;
import com.facebook.android.SessionEvents.AuthListener;

public class FacebookLogin extends Activity{

	public static final String APP_ID = "135034016567364";
	private LoginButton mLoginButton;
	private Facebook mFacebook;
	private AsyncFacebookRunner mAsyncRunner;
	
	/** Called when the activity is first created. */
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		 setContentView(R.layout.snapmain);

		mFacebook = new Facebook(APP_ID);
		mAsyncRunner = new AsyncFacebookRunner(mFacebook);

		SessionStore.restore(mFacebook, this);
		SessionEvents.addAuthListener(new SampleAuthListener());
		mLoginButton = (LoginButton) findViewById(R.id.login);
		mLoginButton.init(this, mFacebook);
	}

	public class SampleAuthListener implements AuthListener {

		public void onAuthSucceed() {
			//   nameTextView.setText("You have logged in! ");
		}

		public void onAuthFail(String error) {
			//   nameTextView.setText("Login Failed: " + error);
		}
	}

}
